export type Params = Record<string | number | symbol, any>
export type Method =
		| 'get' | 'GET'
		| 'delete' | 'DELETE'
		| 'head' | 'HEAD'
		| 'options' | 'OPTIONS'
		| 'post' | 'POST'
		| 'put' | 'PUT'
		| 'patch' | 'PATCH'
		| 'purge' | 'PURGE'
		| 'link' | 'LINK'
		| 'unlink' | 'UNLINK'
export interface RequestConfig {
	/**
	 * 请求地址
	 */
	url?: string;
	/**
	 * 请求方式
	 */
	method?: Method;
	/**
	 * 请求头
	 */
	headers?: Record<string, any>;
	/**
	 * 地址上的参数
	 */
	params?: any;
	/**
	 * 请求体上的参数
	 */
	data?: any;
}

/**
 * 统一的返回实体类型
 */
export interface AdapterResponse<T> {
	code?: number | string
	status?: number | string
	msg?: string
	message?: string
	data?: T
	records?: T
	content?: T
	result?: {
		data?: T
	}
}
/**
 * 定义的统一请求接口(旧版，废弃)
 */
export type StartRequest = <T>(
		url: string,
		method: Method,
		data?: Params,
		params?: Params,
		headers?: Params
) => Promise<T>
/**
 * 定义的统一请求接口
 */
export type AdapterRequest =<T = any, R = AdapterResponse<T>>(config: RequestConfig)=>Promise<R>


export interface HttpServicesAdapter2{
	request<T = any, R = AdapterResponse<T>> (config: RequestConfig): Promise<R>;
	get<T = any, R = AdapterResponse<T>>(url: string, config?: RequestConfig): Promise<R>;
	delete<T = any, R = AdapterResponse<T>>(url: string, config?: RequestConfig): Promise<R>;
	head<T = any, R = AdapterResponse<T>>(url: string, config?: RequestConfig): Promise<R>;
	options<T = any, R = AdapterResponse<T>>(url: string, config?: RequestConfig): Promise<R>;
	post<T = any, R = AdapterResponse<T>>(url: string, data?: any, config?: RequestConfig): Promise<R>;
	put<T = any, R = AdapterResponse<T>>(url: string, data?: any, config?: RequestConfig): Promise<R>;
	patch<T = any, R = AdapterResponse<T>>(url: string, data?: any, config?: RequestConfig): Promise<R>;
}
